package xyz.xtt.exchange.vo;

import java.time.LocalDateTime;
import java.util.Objects;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import xyz.xtt.exchange.entity.TblAssetAudit;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AssetAuditVo {
    private Long id;
    private String assetName;
    private String imgPath;
    private String videoPath;
    private Long assetId;
    private LocalDateTime createTime;
    private Integer result;
    private Integer status;
    private Integer payStatus;

    public static AssetAuditVo create(TblAssetAudit assetAudit, Integer status) {
        if(Objects.isNull(assetAudit)) {
            return null;
        }
       return  AssetAuditVo.builder().id(assetAudit.getId())
                .assetName(assetAudit.getAssetName())
                .imgPath(assetAudit.getImgPath())
               .videoPath(assetAudit.getVideoPath())
                .assetId(assetAudit.getAssetId().equals(0L) ? null : assetAudit.getAssetId())
                .createTime(assetAudit.getCreateTime())
                .result(assetAudit.getResult())
                .status(assetAudit.getState())
               .payStatus(status)
                .build();
    }
}
